Visual Basic (Declaration) | |
---|---|
Public Overloads Function SaveChangesAsync( _ ByVal userCallback As Action(Of EntitySaveOperation), _ Optional ByVal userState As Object _ ) As EntitySaveOperation |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As EntityManager Dim userCallback As Action(Of EntitySaveOperation) Dim userState As Object Dim value As EntitySaveOperation value = instance.SaveChangesAsync(userCallback, userState) |
C# | |
---|---|
public EntitySaveOperation SaveChangesAsync( Action<EntitySaveOperation> userCallback, object userState ) |
C++/CLI | |
---|---|
public: EntitySaveOperation^ SaveChangesAsync( Action<EntitySaveOperation^>^ userCallback, Object^ userState ) |
Parameters
- userCallback
- Callback invoked when asynchronous operation completes
- userState
- Token identifying the asynchronous operation
C# | ![]() |
---|---|
public void AsyncSaveSimple() { DomainModelEntityManager mgr = new DomainModelEntityManager(); Customer c1 = new Customer() { CompanyName = "Toys R Us" }; mgr.AddEntity(c1); Customer c2 = new Customer() { CompanyName = "Apple" }; mgr.AddEntity(c2); // Save all modified entities using default SaveOptions. // Use a lambda expression which takes the EntitySaveOperation. // The userstate token is left null since it's optional. mgr.SaveChangesAsync(op => { SaveResult sr = op.SaveResult; MessageBox.Show(sr.Ok.ToString()); }, null); } |
Provide a userCallback if you want to be notified when the operation completes. The EntitySaveOperation passed to the userCallback will contain the results of the save operation. Use the userState to uniquely identify this call. You can cancel a pending asynchronous call using EntitySaveOperation.Cancel().
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family